package com.rms.hkpc.presenter;

import com.google.gson.reflect.TypeToken;
import com.rms.hkpc.apiresult.ApiResultData;
import com.rms.hkpc.model.LoginModel;
import com.rms.hkpc.model.listener.OnResultListener;
import com.rms.hkpc.view.IForgotPwView;

public class ForgotPwPresenter extends BasePresenter<IForgotPwView> {
    private LoginModel loginModel = new LoginModel();

    public void forgotPw() {
        loginModel.forgotPw(getView().getEmail(), new OnResultListener() {
            @Override
            public void onSuccess(Object apiResult) {
                if (getView() != null) {
                    getView().onGetDataSuccess((ApiResultData<String>) apiResult);
                }
            }

            @Override
            public void onFails(Exception e) {
                if (getView() != null) {
                    getView().onGetDataFails(e);
                }
            }
        }, new TypeToken<ApiResultData<String>>() {
        }.getType());
    }
}
